import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useLLMStore = defineStore('llm', () => {
  const showLLMDialog = ref(false)
  const selectedModels = ref<string[]>([])
  const selectedQuestions = ref<number[]>([])
  
  const availableModels = [
    { value: 'gpt-4-gizmo-*', label: 'gpt-4-gizmo-*' },
    { value: 'gpt-4o', label: 'gpt-4o' },
    { value: 'deepseek-chat', label: 'deepseek-chat' },
    { value: 'deepseek-r1', label: 'deepseek-r1' },
    { value: 'grok-3', label: 'grok-3' },
    { value: 'grok-3-reasoning', label: 'grok-3-reasoning' },
  ]

  const toggleLLMDialog = () => {
    const wasOpen = showLLMDialog.value
    showLLMDialog.value = !wasOpen
    if (wasOpen) {
      // 关闭弹窗时清空选中状态
      selectedModels.value = []
      selectedQuestions.value = []
    }
  }

  return {
    showLLMDialog,
    selectedModels,
    selectedQuestions,
    availableModels,
    toggleLLMDialog
  }
})
